package com.chenyongjing.design.pattern.delegate.simple;

import java.util.HashMap;
import java.util.Map;

public class Leader implements IEmployee{
    private Map<String,IEmployee> employeeMap = new HashMap<String,IEmployee>();

    public Leader(){
        employeeMap.put("python",new EmployeeA());
        employeeMap.put("java",new EmployeeB());
    }

    @Override
    public void doing(String task) {
        if(!employeeMap.containsKey(task)){
            System.out.println("这个任务"+task+"超出我的能力范围");
            return;
        }
        employeeMap.get(task).doing(task);

//        if("python".equals(task)){
//            new EmployeeA().doing(task);
//        }else if("java".equals(task)){
//            new EmployeeB().doing(task);
//        }else {
//            System.oust.println("目前没有资源");
//        }
    }
}
